package com.goldcn.user.controller;

import com.goldcn.user.model.Logistics;
import com.goldcn.user.service.LogisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by 1111 on 2016/11/19.
 */
@Api(value = "物流公司管理")
@RestController
@RequestMapping(value = "/logistics")
public class LogisticsController {
    @Autowired
    LogisticsService logisticsService;

    @ApiOperation(value = "新增物流公司")
    @RequestMapping(method = RequestMethod.POST)
    public Object addLogistics(@RequestBody Logistics logistics){
        return logisticsService.addLogistics(logistics);
    }

    @ApiOperation(value = "修改物流公司")
    @RequestMapping(method = RequestMethod.PUT)
    public Object updateLogistics(@RequestBody Logistics logistics){
        return logisticsService.updateLogistics(logistics);
    }

    @ApiOperation(value = "删除物流公司")
    @RequestMapping(value = "/{id}",method = RequestMethod.DELETE)
    public Object deleteLogistics(@PathVariable Long id){
        return logisticsService.deleteLogistics(id);
    }

    @ApiOperation(value = "按id查询物流公司")
    @RequestMapping(value = "/{id}",method = RequestMethod.GET)
    public Object selectLogisticsByID(@PathVariable Long id){
        return logisticsService.selectByID(id);
    }

    @ApiOperation(value = "查询所有物流公司")
    @RequestMapping(method = RequestMethod.GET)
    public Object selectAll(){
        return logisticsService.selectAll();
    }
}

